package cn.crm.controller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.crm.Service.ISaleChanceService;
import cn.crm.common.ServerResponse;
import cn.crm.entity.SaleChance;

@Controller
@RequestMapping("salechance")
public class SaleChanceController {

	@Autowired
	private ISaleChanceService salechanceservice;
	
	@RequestMapping(value="tosalechancepage")
	public String  tosalechancepage() {
		return "salechance/salechance_list";
	}
	
	@RequestMapping(value="pageList")
	@ResponseBody
	public ServerResponse pageList(int page,int limit,SaleChance saleChance){
		System.err.println(saleChance);
		return salechanceservice.pageList(page,limit,saleChance);
	}
	
	@RequestMapping(value="toinsertpage")
	public String toinsertpage(){
		return "salechance/salechance_insert";
	}
	
	@RequestMapping(value="insert")
	@ResponseBody
	public ServerResponse insert(SaleChance saleChance){
		return salechanceservice.insert(saleChance);
	}
	
	@RequestMapping(value="deleteById")
	@ResponseBody
	public ServerResponse deleteById(Integer id){
		return salechanceservice.deleteById(id);
	}
	@RequestMapping(value="exprotExcle")
	public void exprotExcle(HttpServletResponse response){
		salechanceservice.exprotExcle(response);
	}
	
	
}
